Summary on deep learning framework

您所在的位置:网站首页 pytorch tensor截取 Summary on deep learning framework

Summary on deep learning framework

#Summary on deep learning framework | 来源: 网络整理| 查看: 265

image = gm.Image('/path/to/image.png') -- or image = gm.Image() image:load('/path/to/image.png')  但是悲剧的仍然有错, 只好换了用 image.load() 的方式加载图像:   --To load as byte tensor for rgb imagefile local img = image.load(imagefile,3,'byte')    4. Torch 保存 txt 文件:  -- save opt   file = torch.DiskFile(paths.concat(opt.checkpoints_dir, opt.name, 'opt.txt'), 'w')   file:writeObject(opt)   file:close()     5. Torch 创建新的文件夹  opts.modelPath = opt.modelDir .. opt.modelName   if not paths.dirp(opt.modelPath) then     paths.mkdir(opts.modelPath)   end   6. Torch Lua 保存 图像到文件夹   借助 image package,首先安装: luarocks install image   然后 require 'image'   就可以使用了: local img = image.save('./saved_pos_neg_image/candidate_' .. tostring(i) .. tostring(j) .. '.png', pos_patch, 1, 32, 32)   7. module 'bit' not found:No LuaRocks module found for bit

[email protected]:/media/wangxiao/724eaeef-e688-4b09-9cc9-dfaca44079b2/fast-neural-style-master$ th ./train.lua /home/wangxiao/torch/install/bin/lua: /home/wangxiao/torch/install/share/lua/5.2/trepl/init.lua:389: /home/wangxiao/torch/install/share/lua/5.2/trepl/init.lua:389: /home/wangxiao/torch/install/share/lua/5.2/trepl/init.lua:389: module 'bit' not found:No LuaRocks module found for bit no field package.preload['bit'] no file '/home/wangxiao/.luarocks/share/lua/5.2/bit.lua' no file '/home/wangxiao/.luarocks/share/lua/5.2/bit/init.lua' no file '/home/wangxiao/torch/install/share/lua/5.2/bit.lua' no file '/home/wangxiao/torch/install/share/lua/5.2/bit/init.lua' no file '/home/wangxiao/.luarocks/share/lua/5.1/bit.lua' no file '/home/wangxiao/.luarocks/share/lua/5.1/bit/init.lua' no file '/home/wangxiao/torch/install/share/lua/5.1/bit.lua' no file '/home/wangxiao/torch/install/share/lua/5.1/bit/init.lua' no file './bit.lua' no file '/home/wangxiao/torch/install/share/luajit-2.1.0-beta1/bit.lua' no file '/usr/local/share/lua/5.1/bit.lua' no file '/usr/local/share/lua/5.1/bit/init.lua' no file '/home/wangxiao/.luarocks/lib/lua/5.2/bit.so' no file '/home/wangxiao/torch/install/lib/lua/5.2/bit.so' no file '/home/wangxiao/torch/install/lib/bit.so' no file '/home/wangxiao/.luarocks/lib/lua/5.1/bit.so' no file '/home/wangxiao/torch/install/lib/lua/5.1/bit.so' no file './bit.so' no file '/usr/local/lib/lua/5.1/bit.so' no file '/usr/local/lib/lua/5.1/loadall.so'stack traceback: [C]: in function 'error' /home/wangxiao/torch/install/share/lua/5.2/trepl/init.lua:389: in function 'require' ./train.lua:5: in main chunk [C]: in function 'dofile' ...xiao/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: in ?[email protected]:/media/wangxiao/724eaeef-e688-4b09-9cc9-dfaca44079b2/fast-neural-style-master$

在终端中执行:luarocks install luabitop 就可以了。 8.  HDF5Group:read() - no such child 'media' for [HDF5Group 33554432 /]

/home/wangxiao/torch/install/bin/lua: /home/wangxiao/torch/install/share/lua/5.2/hdf5/group.lua:312: HDF5Group:read() - no such child 'media' for [HDF5Group 33554432 /]stack traceback: [C]: in function 'error' /home/wangxiao/torch/install/share/lua/5.2/hdf5/group.lua:312: in function (...tail calls...) ./fast_neural_style/DataLoader.lua:44: in function '__init' /home/wangxiao/torch/install/share/lua/5.2/torch/init.lua:91: in function [C]: in function 'DataLoader' ./train.lua:138: in function 'main' ./train.lua:327: in main chunk [C]: in function 'dofile' ...xiao/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: in ? 

 

最近在训练 类型迁移的代码,发现这个蛋疼的问题。哎。。纠结好几天了。。这个 hdf5 到底怎么回事 ?  求解释 !!! 

------------------------------------------------------------------------------------------------

  后来发现, 是我自己的数据集路径设置的有问题, 如: 应该是 CoCo/train/image/ 

  但是,我只是给定了 CoCo/train/ ...

 

 

 

 

  9. 怎么设置 torch代码在哪块 GPU 上运行 ? 或者 怎么设置在两块卡上同时运行 ?

  

    

  如图所示: export CUDA_VISIBLE_DEVICES=0 即可指定代码在 GPU-0 上运行. 

  

  10.  When load the pre-trained VGG model, got the following errors: 

 

    MODULE data UNDEFINED    warning: module 'data [type 5]' not found    nn supports no groups!    warning: module 'conv2 [type 4]' not found    nn supports no groups!    warning: module 'conv4 [type 4]' not found    nn supports no groups!    warning: module 'conv5 [type 4]' not found

 

  

1 using cudnn 2 Successfully loaded ./feature_transfer/AlexNet_files/bvlc_alexnet.caffemodel 3 MODULE data UNDEFINED 4 warning: module 'data [type 5]' not found 5 nn supports no groups! 6 warning: module 'conv2 [type 4]' not found 7 nn supports no groups! 8 warning: module 'conv4 [type 4]' not found 9 nn supports no groups! 10 warning: module 'conv5 [type 4]' not found

 

1 [email protected]:~/Downloads/multi-modal-visual-tracking$ qlua ./train_match_function_alexNet_version_2017_02_28.lua 2 using cudnn 3 Successfully loaded ./feature_transfer/AlexNet_files/bvlc_alexnet.caffemodel 4 MODULE data UNDEFINED 5 warning: module 'data [type 5]' not found 6 nn supports no groups! 7 warning: module 'conv2 [type 4]' not found 8 nn supports no groups! 9 warning: module 'conv4 [type 4]' not found 10 nn supports no groups! 11 warning: module 'conv5 [type 4]' not found 12 conv1: 96 3 11 11 13 conv3: 384 256 3 3 14 fc6: 1 1 9216 4096 15 fc7: 1 1 4096 4096 16 fc8: 1 1 4096 1000 17 nn.Sequential { 18 [input -> (1) -> (2) -> (3) -> output] 19 (1): nn.SplitTable 20 (2): nn.ParallelTable { 21 input 22 |`-> (1): nn.Sequential { 23 | [input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> (7) -> (8) -> (9) -> (10) -> (11) -> (12) -> (13) -> (14) -> (15) -> (16) -> (17) -> (18) -> output] 24 | (1): nn.SpatialConvolution(3 -> 96, 11x11, 4,4) 25 | (2): nn.ReLU 26 | (3): nn.SpatialCrossMapLRN 27 | (4): nn.SpatialMaxPooling(3x3, 2,2) 28 | (5): nn.ReLU 29 | (6): nn.SpatialCrossMapLRN 30 | (7): nn.SpatialMaxPooling(3x3, 2,2) 31 | (8): nn.SpatialConvolution(256 -> 384, 3x3, 1,1, 1,1) 32 | (9): nn.ReLU 33 | (10): nn.ReLU 34 | (11): nn.ReLU 35 | (12): nn.SpatialMaxPooling(3x3, 2,2) 36 | (13): nn.View(-1) 37 | (14): nn.Linear(9216 -> 4096) 38 | (15): nn.ReLU 39 | (16): nn.Dropout(0.500000) 40 | (17): nn.Linear(4096 -> 4096) 41 | (18): nn.ReLU 42 | } 43 `-> (2): nn.Sequential { 44 [input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> (7) -> (8) -> (9) -> (10) -> (11) -> (12) -> (13) -> (14) -> (15) -> (16) -> (17) -> (18) -> output] 45 (1): nn.SpatialConvolution(3 -> 96, 11x11, 4,4) 46 (2): nn.ReLU 47 (3): nn.SpatialCrossMapLRN 48 (4): nn.SpatialMaxPooling(3x3, 2,2) 49 (5): nn.ReLU 50 (6): nn.SpatialCrossMapLRN 51 (7): nn.SpatialMaxPooling(3x3, 2,2) 52 (8): nn.SpatialConvolution(256 -> 384, 3x3, 1,1, 1,1) 53 (9): nn.ReLU 54 (10): nn.ReLU 55 (11): nn.ReLU 56 (12): nn.SpatialMaxPooling(3x3, 2,2) 57 (13): nn.View(-1) 58 (14): nn.Linear(9216 -> 4096) 59 (15): nn.ReLU 60 (16): nn.Dropout(0.500000) 61 (17): nn.Linear(4096 -> 4096) 62 (18): nn.ReLU 63 } 64 ... -> output 65 } 66 (3): nn.PairwiseDistance 67 } 68 ================================================================================================================= 69 ================= AlextNet based Siamese Search for Visual Tracking ======================== 70 ================================================================================================================= 71 ==>> The Benchmark Contain: 36 videos ... 72 deal with video 1/36 video name: BlurFace ... please waiting ... 73 the num of gt bbox: 493 74 the num of video frames: 493 75 ========>>>> Begin to track 2 video name: nil-th frame, please waiting ... 76 ========>>>> Begin to track 3 video name: nil-th frame, please waiting ... ............] ETA: 0ms | Step: 0ms 77 ========>>>> Begin to track 4 video name: nil-th frame, please waiting ... ............] ETA: 39s424ms | Step: 80ms 78 ========>>>> Begin to track 5 video name: nil-th frame, please waiting ... ............] ETA: 33s746ms | Step: 69ms 79 ========>>>> Begin to track 6 video name: nil-th frame, please waiting ... ............] ETA: 31s817ms | Step: 65ms 80 ========>>>> Begin to track 7 video name: nil-th frame, please waiting ... ............] ETA: 32s575ms | Step: 66ms 81 ========>>>> Begin to track 8 video name: nil-th frame, please waiting ... ............] ETA: 34s376ms | Step: 70ms 82 ========>>>> Begin to track 9 video name: nil-th frame, please waiting ... ............] ETA: 40s240ms | Step: 82ms 83 ========>>>> Begin to track 10 video name: nil-th frame, please waiting ... ...........] ETA: 44s211ms | Step: 91ms 84 ========>>>> Begin to track 11 video name: nil-th frame, please waiting ... ...........] ETA: 45s993ms | Step: 95ms 85 ========>>>> Begin to track 12 video name: nil-th frame, please waiting ... ...........] ETA: 47s754ms | Step: 99ms 86 ========>>>> Begin to track 13 video name: nil-th frame, please waiting ... ...........] ETA: 50s392ms | Step: 104ms 87 ========>>>> Begin to track 14 video name: nil-th frame, please waiting ... ...........] ETA: 53s138ms | Step: 110ms 88 ========>>>> Begin to track 15 video name: nil-th frame, please waiting ... ...........] ETA: 55s793ms | Step: 116ms 89 ========>>>> Begin to track 16 video name: nil-th frame, please waiting ... ...........] ETA: 59s253ms | Step: 123ms 90 ========>>>> Begin to track 17 video name: nil-th frame, please waiting ... ...........] ETA: 1m2s | Step: 130ms 91 ========>>>> Begin to track 18 video name: nil-th frame, please waiting ... ...........] ETA: 1m5s | Step: 137ms 92 ========>>>> Begin to track 19 video name: nil-th frame, please waiting ... ...........] ETA: 1m8s | Step: 143ms 93 ========>>>> Begin to track 20 video name: nil-th frame, please waiting ... ...........] ETA: 1m11s | Step: 149ms 94 //..............] ETA: 1m14s | Step: 157ms 95 ==>> pos_proposal_list: 19 96 ==>> neg_proposal_list: 19 97 qlua: /home/wangxiao/torch/install/share/lua/5.1/nn/Container.lua:67: 98 In 2 module of nn.Sequential: 99 In 1 module of nn.ParallelTable: 100 In 8 module of nn.Sequential: 101 /home/wangxiao/torch/install/share/lua/5.1/nn/THNN.lua:117: Need input of dimension 3 and input.size[0] == 256 but got input to be of shape: [96 x 13 x 13] at /tmp/luarocks_cunn-scm-1-6210/cunn/lib/THCUNN/generic/SpatialConvolutionMM.cu:49 102 stack traceback: 103 [C]: in function 'v' 104 /home/wangxiao/torch/install/share/lua/5.1/nn/THNN.lua:117: in function 'SpatialConvolutionMM_updateOutput' 105 ...ao/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:79: in function 106 [C]: in function 'xpcall' 107 /home/wangxiao/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' 108 ...e/wangxiao/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 109 [C]: in function 'xpcall' 110 /home/wangxiao/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' 111 ...angxiao/torch/install/share/lua/5.1/nn/ParallelTable.lua:12: in function 112 [C]: in function 'xpcall' 113 /home/wangxiao/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' 114 ...e/wangxiao/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward' 115 ./train_match_function_alexNet_version_2017_02_28.lua:525: in function 'opfunc' 116 /home/wangxiao/torch/install/share/lua/5.1/optim/adam.lua:37: in function 'optim' 117 ./train_match_function_alexNet_version_2017_02_28.lua:550: in main chunk 118 119 120 121 WARNING: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above. 122 stack traceback: 123 [C]: at 0x7f86014df9c0 124 [C]: in function 'error' 125 /home/wangxiao/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors' 126 ...e/wangxiao/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward' 127 ./train_match_function_alexNet_version_2017_02_28.lua:525: in function 'opfunc' 128 /home/wangxiao/torch/install/share/lua/5.1/optim/adam.lua:37: in function 'optim' 129 ./train_match_function_alexNet_version_2017_02_28.lua:550: in main chunk 130 [email protected]:~/Downloads/multi-modal-visual-tracking$

 

 

  Just like the screen shot above, change the 'nn' into 'cudnn' will be ok and passed. 

 

  11. both (null) and torch.FloatTensor have no less-than operator

    qlua: ./test_MM_tracker_VGG_.lua:254: both (null) and torch.FloatTensor have no less-than operator    stack traceback:     [C]: at 0x7f628816e9c0     [C]: in function '__lt'     ./test_MM_tracker_VGG_.lua:254: in main chunk 

  

  Because it is floatTensor () style and you can change it like this if you want this value printed in a for loop: predictValue -->> predictValue[i] .

   

 

  12. 

========>>>> Begin to track the 6-th and the video name is ILSVRC2015_train_00109004 , please waiting ... THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-707/cutorch/lib/THC/generic/THCStorage.cu line=66 error=2 : out of memoryqlua: cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-707/cutorch/lib/THC/generic/THCStorage.cu:66stack traceback: [C]: at 0x7fa20a8f99c0 [C]: at 0x7fa1dddfbee0 [C]: in function 'Tensor' ./train_match_function_VGG_version_2017_03_02.lua:377: in main chunk[email protected]:~/Downloads/multi-modal-visual-tracking$

 

    Yes, it is just out of memory of GPU. Just turn the batchsize to a small value, it may work. It worked for me. Ha ha ... 

 

 13. luarocks install class does not have any effect, it still shown me the error: No Module named "class" in Torch. 

  ==>> in terminal, install this package in sudo.

  ==>> then, it will be OK.  

 

14. How to install opencv 3.1 on Ubuntu 14.04 ??? 

  As we can found from: http://blog.csdn.net/a125930123/article/details/52091140  

  1. first, you should install torch successfully ; 

  2. then, just follow what the blog said here: 

安装opencv3.1 1、安装必要的包 sudo apt-get install build-essentialsudo apt-get install cmake git libgtk2 2、下载opencv3.1 http://opencv.org/downloads.html解压:unzip opencv-3.1.0 3、安装cd ~/opencv-3.1.0mkdir buildcd buildcmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. sudo make -j24 sudo make install -j24  sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'sudo ldconfig 安装完成 4、问题 在安装过程中可能会出现无法下载 ippicv_linux_20151201.tgz的问题。 解决方案: 手动下载ippicv_linux_20151201.tgz:https://raw.githubusercontent.com/Itseez/opencv_3rdparty/81a676001ca8075ada498583e4166079e5744668/ippicv/ippicv_linux_20151201.tgz 将下载好的文件 放入 opencv-3.1.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e 中,如果已经存在 ,则替换掉,这样就可以安装完成了。 5、最后执行命令 luarocks install cv OpenCV bindings for Torch安装成功。 

But, maybe you may found some errors, such as: 

cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared    (solution draw from: http://blog.csdn.net/allyli0022/article/details/62859290)

At this moment, you need to change some files: 

found graphcuts.cpp in opencv3.1, and do the following changes: 

解决方案:需要修改一处源码: 在graphcuts.cpp中将 #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) 改为 #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= then, try again, it will be ok...this code just want to make opencv3.1 work under cuda 8.0, you know...skip that judge sentence... sudo apt-get install libhdf5-serial-dev hdf5-tools git clone https://github.com/deepmind/torch-hdf5 cd torch-hdf5 sudo luarocks make hdf5-0-0.rockspec LIBHDF5_LIBDIR=”/usr/lib/x86_64-Linux-gnu/”

17. iTorch安装 

git clone https://github.com/zeromq/zeromq4-1.git mkdir build-zeromq cd build-zeromq cmake .. make && make install 安装完之后,luarocks install itorch 之后可以通过luarocks list查看是否安装成功

 

 

 

 

 

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3